package net.zjitc.redis;

import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

/**
 * @Author admin
 * @Date 2019/5/21 8:24
 */
public class redisCommandImpl implements redisCommand{
    @Autowired
    JedisPool jedisPool;
    @Override
    public void putObject(String key, String value) {
        Jedis jedis = jedisPool.getResource();
        jedis.set(key,value);
    }

    @Override
    public String getObject(String key) {
        Jedis jedis = jedisPool.getResource();
        String value = jedis.get(key);
        return value;
    }

    @Override
    public boolean removeObject(String key) {
        Jedis jedis = jedisPool.getResource();
        Long value = jedis.del(key);
        if (value == 1)
        {
            return true;
        }
        return false;
    }

    @Override
    public void clean() {

    }

    @Override
    public int getsize() {
        return 0;
    }
}
